﻿using System.Windows.Data;
using Project5188.BUS;
using Project5188.BUS.Operations;
using Project5188.BUS.SalesAndCustomerRelations;

namespace Project5188.Client.SalesAndCustomerRelations.Reports
{
    /// <summary>
    /// Interaction logic for CustomerDigitalInfoReportPage.xaml
    /// </summary>
    public partial class CustomerDigitalInfoReportPage
    {
        private CollectionViewSource _resources;

        public CustomerDigitalInfoReportPage()
            : base(Extensions.PageNames.CustomerDigitalInfoReportPage)
        {
            InitializeComponent();

            BindData();
        }

        private void BindData()
        {
            var customerInfos = new CustomerInfos();
            _resources = Resources["customerTypeInfosViewSource"] as CollectionViewSource;
            if (_resources != null) _resources.Source = customerInfos.GetCustomerTypeInfoReport();

            _resources = Resources["customerMonthlyInfosViewSource"] as CollectionViewSource;
            if (_resources != null) _resources.Source = customerInfos.GetMonthlyCustomerCountReport();

            _resources = Resources["serviceTypeInfosViewSource"] as CollectionViewSource;
            if (_resources != null) _resources.Source = customerInfos.GetServiceTypeInfoReport();

            var personnelInfos = new PersonnelInfos();
            _resources = Resources["personnelInfosViewSource"] as CollectionViewSource;
            if (_resources != null) _resources.Source = personnelInfos.GetWorkingPeopleCountReport();
        }
    }
}
